Left Termination of the query pattern t_in_1(g) w.r.t. the given Prolog program could successfully be proven:



Prolog
  ↳ PrologToPiTRSProof

Clauses:

t(N) :- ','(ll(N, Xs), ','(select(X, Xs, Xs1), ','(ll(M, Xs1), t(M)))).
t(0).
ll(s(N), .(X, Xs)) :- ll(N, Xs).
ll(0, []).
select(X, .(Y, Xs), .(Y, Ys)) :- select(X, Xs, Ys).
select(X, .(X, Xs), Xs).

Queries:

t(g).

We use the technique of [30]. With regard to the inferred argument filtering the predicates were used in the following modes:
t_in: (b)
ll_in: (b,f) (f,b)
select_in: (f,b,f)
Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

t_in_g(N) → U1_g(N, ll_in_ga(N, Xs))
ll_in_ga(s(N), .(X, Xs)) → U5_ga(N, X, Xs, ll_in_ga(N, Xs))
ll_in_ga(0, []) → ll_out_ga(0, [])
U5_ga(N, X, Xs, ll_out_ga(N, Xs)) → ll_out_ga(s(N), .(X, Xs))
U1_g(N, ll_out_ga(N, Xs)) → U2_g(N, select_in_aga(X, Xs, Xs1))
select_in_aga(X, .(Y, Xs), .(Y, Ys)) → U6_aga(X, Y, Xs, Ys, select_in_aga(X, Xs, Ys))
select_in_aga(X, .(X, Xs), Xs) → select_out_aga(X, .(X, Xs), Xs)
U6_aga(X, Y, Xs, Ys, select_out_aga(X, Xs, Ys)) → select_out_aga(X, .(Y, Xs), .(Y, Ys))
U2_g(N, select_out_aga(X, Xs, Xs1)) → U3_g(N, ll_in_ag(M, Xs1))
ll_in_ag(s(N), .(X, Xs)) → U5_ag(N, X, Xs, ll_in_ag(N, Xs))
ll_in_ag(0, []) → ll_out_ag(0, [])
U5_ag(N, X, Xs, ll_out_ag(N, Xs)) → ll_out_ag(s(N), .(X, Xs))
U3_g(N, ll_out_ag(M, Xs1)) → U4_g(N, t_in_g(M))
t_in_g(0) → t_out_g(0)
U4_g(N, t_out_g(M)) → t_out_g(N)

The argument filtering Pi contains the following mapping:
t_in_g(x1)  =  t_in_g(x1)
U1_g(x1, x2)  =  U1_g(x2)
ll_in_ga(x1, x2)  =  ll_in_ga(x1)
s(x1)  =  s(x1)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x4)
0  =  0
ll_out_ga(x1, x2)  =  ll_out_ga(x2)
.(x1, x2)  =  .(x2)
U2_g(x1, x2)  =  U2_g(x2)
select_in_aga(x1, x2, x3)  =  select_in_aga(x2)
U6_aga(x1, x2, x3, x4, x5)  =  U6_aga(x5)
select_out_aga(x1, x2, x3)  =  select_out_aga(x3)
U3_g(x1, x2)  =  U3_g(x2)
ll_in_ag(x1, x2)  =  ll_in_ag(x2)
U5_ag(x1, x2, x3, x4)  =  U5_ag(x4)
[]  =  []
ll_out_ag(x1, x2)  =  ll_out_ag(x1)
U4_g(x1, x2)  =  U4_g(x2)
t_out_g(x1)  =  t_out_g

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog



↳ Prolog
  ↳ PrologToPiTRSProof
PiTRS
      ↳ DependencyPairsProof

Pi-finite rewrite system:
The TRS R consists of the following rules:

t_in_g(N) → U1_g(N, ll_in_ga(N, Xs))
ll_in_ga(s(N), .(X, Xs)) → U5_ga(N, X, Xs, ll_in_ga(N, Xs))
ll_in_ga(0, []) → ll_out_ga(0, [])
U5_ga(N, X, Xs, ll_out_ga(N, Xs)) → ll_out_ga(s(N), .(X, Xs))
U1_g(N, ll_out_ga(N, Xs)) → U2_g(N, select_in_aga(X, Xs, Xs1))
select_in_aga(X, .(Y, Xs), .(Y, Ys)) → U6_aga(X, Y, Xs, Ys, select_in_aga(X, Xs, Ys))
select_in_aga(X, .(X, Xs), Xs) → select_out_aga(X, .(X, Xs), Xs)
U6_aga(X, Y, Xs, Ys, select_out_aga(X, Xs, Ys)) → select_out_aga(X, .(Y, Xs), .(Y, Ys))
U2_g(N, select_out_aga(X, Xs, Xs1)) → U3_g(N, ll_in_ag(M, Xs1))
ll_in_ag(s(N), .(X, Xs)) → U5_ag(N, X, Xs, ll_in_ag(N, Xs))
ll_in_ag(0, []) → ll_out_ag(0, [])
U5_ag(N, X, Xs, ll_out_ag(N, Xs)) → ll_out_ag(s(N), .(X, Xs))
U3_g(N, ll_out_ag(M, Xs1)) → U4_g(N, t_in_g(M))
t_in_g(0) → t_out_g(0)
U4_g(N, t_out_g(M)) → t_out_g(N)

The argument filtering Pi contains the following mapping:
t_in_g(x1)  =  t_in_g(x1)
U1_g(x1, x2)  =  U1_g(x2)
ll_in_ga(x1, x2)  =  ll_in_ga(x1)
s(x1)  =  s(x1)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x4)
0  =  0
ll_out_ga(x1, x2)  =  ll_out_ga(x2)
.(x1, x2)  =  .(x2)
U2_g(x1, x2)  =  U2_g(x2)
select_in_aga(x1, x2, x3)  =  select_in_aga(x2)
U6_aga(x1, x2, x3, x4, x5)  =  U6_aga(x5)
select_out_aga(x1, x2, x3)  =  select_out_aga(x3)
U3_g(x1, x2)  =  U3_g(x2)
ll_in_ag(x1, x2)  =  ll_in_ag(x2)
U5_ag(x1, x2, x3, x4)  =  U5_ag(x4)
[]  =  []
ll_out_ag(x1, x2)  =  ll_out_ag(x1)
U4_g(x1, x2)  =  U4_g(x2)
t_out_g(x1)  =  t_out_g


Using Dependency Pairs [1,30] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

T_IN_G(N) → U1_G(N, ll_in_ga(N, Xs))
T_IN_G(N) → LL_IN_GA(N, Xs)
LL_IN_GA(s(N), .(X, Xs)) → U5_GA(N, X, Xs, ll_in_ga(N, Xs))
LL_IN_GA(s(N), .(X, Xs)) → LL_IN_GA(N, Xs)
U1_G(N, ll_out_ga(N, Xs)) → U2_G(N, select_in_aga(X, Xs, Xs1))
U1_G(N, ll_out_ga(N, Xs)) → SELECT_IN_AGA(X, Xs, Xs1)
SELECT_IN_AGA(X, .(Y, Xs), .(Y, Ys)) → U6_AGA(X, Y, Xs, Ys, select_in_aga(X, Xs, Ys))
SELECT_IN_AGA(X, .(Y, Xs), .(Y, Ys)) → SELECT_IN_AGA(X, Xs, Ys)
U2_G(N, select_out_aga(X, Xs, Xs1)) → U3_G(N, ll_in_ag(M, Xs1))
U2_G(N, select_out_aga(X, Xs, Xs1)) → LL_IN_AG(M, Xs1)
LL_IN_AG(s(N), .(X, Xs)) → U5_AG(N, X, Xs, ll_in_ag(N, Xs))
LL_IN_AG(s(N), .(X, Xs)) → LL_IN_AG(N, Xs)
U3_G(N, ll_out_ag(M, Xs1)) → U4_G(N, t_in_g(M))
U3_G(N, ll_out_ag(M, Xs1)) → T_IN_G(M)

The TRS R consists of the following rules:

t_in_g(N) → U1_g(N, ll_in_ga(N, Xs))
ll_in_ga(s(N), .(X, Xs)) → U5_ga(N, X, Xs, ll_in_ga(N, Xs))
ll_in_ga(0, []) → ll_out_ga(0, [])
U5_ga(N, X, Xs, ll_out_ga(N, Xs)) → ll_out_ga(s(N), .(X, Xs))
U1_g(N, ll_out_ga(N, Xs)) → U2_g(N, select_in_aga(X, Xs, Xs1))
select_in_aga(X, .(Y, Xs), .(Y, Ys)) → U6_aga(X, Y, Xs, Ys, select_in_aga(X, Xs, Ys))
select_in_aga(X, .(X, Xs), Xs) → select_out_aga(X, .(X, Xs), Xs)
U6_aga(X, Y, Xs, Ys, select_out_aga(X, Xs, Ys)) → select_out_aga(X, .(Y, Xs), .(Y, Ys))
U2_g(N, select_out_aga(X, Xs, Xs1)) → U3_g(N, ll_in_ag(M, Xs1))
ll_in_ag(s(N), .(X, Xs)) → U5_ag(N, X, Xs, ll_in_ag(N, Xs))
ll_in_ag(0, []) → ll_out_ag(0, [])
U5_ag(N, X, Xs, ll_out_ag(N, Xs)) → ll_out_ag(s(N), .(X, Xs))
U3_g(N, ll_out_ag(M, Xs1)) → U4_g(N, t_in_g(M))
t_in_g(0) → t_out_g(0)
U4_g(N, t_out_g(M)) → t_out_g(N)

The argument filtering Pi contains the following mapping:
t_in_g(x1)  =  t_in_g(x1)
U1_g(x1, x2)  =  U1_g(x2)
ll_in_ga(x1, x2)  =  ll_in_ga(x1)
s(x1)  =  s(x1)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x4)
0  =  0
ll_out_ga(x1, x2)  =  ll_out_ga(x2)
.(x1, x2)  =  .(x2)
U2_g(x1, x2)  =  U2_g(x2)
select_in_aga(x1, x2, x3)  =  select_in_aga(x2)
U6_aga(x1, x2, x3, x4, x5)  =  U6_aga(x5)
select_out_aga(x1, x2, x3)  =  select_out_aga(x3)
U3_g(x1, x2)  =  U3_g(x2)
ll_in_ag(x1, x2)  =  ll_in_ag(x2)
U5_ag(x1, x2, x3, x4)  =  U5_ag(x4)
[]  =  []
ll_out_ag(x1, x2)  =  ll_out_ag(x1)
U4_g(x1, x2)  =  U4_g(x2)
t_out_g(x1)  =  t_out_g
U2_G(x1, x2)  =  U2_G(x2)
U5_GA(x1, x2, x3, x4)  =  U5_GA(x4)
U4_G(x1, x2)  =  U4_G(x2)
LL_IN_AG(x1, x2)  =  LL_IN_AG(x2)
U6_AGA(x1, x2, x3, x4, x5)  =  U6_AGA(x5)
SELECT_IN_AGA(x1, x2, x3)  =  SELECT_IN_AGA(x2)
T_IN_G(x1)  =  T_IN_G(x1)
U1_G(x1, x2)  =  U1_G(x2)
U3_G(x1, x2)  =  U3_G(x2)
LL_IN_GA(x1, x2)  =  LL_IN_GA(x1)
U5_AG(x1, x2, x3, x4)  =  U5_AG(x4)

We have to consider all (P,R,Pi)-chains

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
PiDP
          ↳ DependencyGraphProof

Pi DP problem:
The TRS P consists of the following rules:

T_IN_G(N) → U1_G(N, ll_in_ga(N, Xs))
T_IN_G(N) → LL_IN_GA(N, Xs)
LL_IN_GA(s(N), .(X, Xs)) → U5_GA(N, X, Xs, ll_in_ga(N, Xs))
LL_IN_GA(s(N), .(X, Xs)) → LL_IN_GA(N, Xs)
U1_G(N, ll_out_ga(N, Xs)) → U2_G(N, select_in_aga(X, Xs, Xs1))
U1_G(N, ll_out_ga(N, Xs)) → SELECT_IN_AGA(X, Xs, Xs1)
SELECT_IN_AGA(X, .(Y, Xs), .(Y, Ys)) → U6_AGA(X, Y, Xs, Ys, select_in_aga(X, Xs, Ys))
SELECT_IN_AGA(X, .(Y, Xs), .(Y, Ys)) → SELECT_IN_AGA(X, Xs, Ys)
U2_G(N, select_out_aga(X, Xs, Xs1)) → U3_G(N, ll_in_ag(M, Xs1))
U2_G(N, select_out_aga(X, Xs, Xs1)) → LL_IN_AG(M, Xs1)
LL_IN_AG(s(N), .(X, Xs)) → U5_AG(N, X, Xs, ll_in_ag(N, Xs))
LL_IN_AG(s(N), .(X, Xs)) → LL_IN_AG(N, Xs)
U3_G(N, ll_out_ag(M, Xs1)) → U4_G(N, t_in_g(M))
U3_G(N, ll_out_ag(M, Xs1)) → T_IN_G(M)

The TRS R consists of the following rules:

t_in_g(N) → U1_g(N, ll_in_ga(N, Xs))
ll_in_ga(s(N), .(X, Xs)) → U5_ga(N, X, Xs, ll_in_ga(N, Xs))
ll_in_ga(0, []) → ll_out_ga(0, [])
U5_ga(N, X, Xs, ll_out_ga(N, Xs)) → ll_out_ga(s(N), .(X, Xs))
U1_g(N, ll_out_ga(N, Xs)) → U2_g(N, select_in_aga(X, Xs, Xs1))
select_in_aga(X, .(Y, Xs), .(Y, Ys)) → U6_aga(X, Y, Xs, Ys, select_in_aga(X, Xs, Ys))
select_in_aga(X, .(X, Xs), Xs) → select_out_aga(X, .(X, Xs), Xs)
U6_aga(X, Y, Xs, Ys, select_out_aga(X, Xs, Ys)) → select_out_aga(X, .(Y, Xs), .(Y, Ys))
U2_g(N, select_out_aga(X, Xs, Xs1)) → U3_g(N, ll_in_ag(M, Xs1))
ll_in_ag(s(N), .(X, Xs)) → U5_ag(N, X, Xs, ll_in_ag(N, Xs))
ll_in_ag(0, []) → ll_out_ag(0, [])
U5_ag(N, X, Xs, ll_out_ag(N, Xs)) → ll_out_ag(s(N), .(X, Xs))
U3_g(N, ll_out_ag(M, Xs1)) → U4_g(N, t_in_g(M))
t_in_g(0) → t_out_g(0)
U4_g(N, t_out_g(M)) → t_out_g(N)

The argument filtering Pi contains the following mapping:
t_in_g(x1)  =  t_in_g(x1)
U1_g(x1, x2)  =  U1_g(x2)
ll_in_ga(x1, x2)  =  ll_in_ga(x1)
s(x1)  =  s(x1)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x4)
0  =  0
ll_out_ga(x1, x2)  =  ll_out_ga(x2)
.(x1, x2)  =  .(x2)
U2_g(x1, x2)  =  U2_g(x2)
select_in_aga(x1, x2, x3)  =  select_in_aga(x2)
U6_aga(x1, x2, x3, x4, x5)  =  U6_aga(x5)
select_out_aga(x1, x2, x3)  =  select_out_aga(x3)
U3_g(x1, x2)  =  U3_g(x2)
ll_in_ag(x1, x2)  =  ll_in_ag(x2)
U5_ag(x1, x2, x3, x4)  =  U5_ag(x4)
[]  =  []
ll_out_ag(x1, x2)  =  ll_out_ag(x1)
U4_g(x1, x2)  =  U4_g(x2)
t_out_g(x1)  =  t_out_g
U2_G(x1, x2)  =  U2_G(x2)
U5_GA(x1, x2, x3, x4)  =  U5_GA(x4)
U4_G(x1, x2)  =  U4_G(x2)
LL_IN_AG(x1, x2)  =  LL_IN_AG(x2)
U6_AGA(x1, x2, x3, x4, x5)  =  U6_AGA(x5)
SELECT_IN_AGA(x1, x2, x3)  =  SELECT_IN_AGA(x2)
T_IN_G(x1)  =  T_IN_G(x1)
U1_G(x1, x2)  =  U1_G(x2)
U3_G(x1, x2)  =  U3_G(x2)
LL_IN_GA(x1, x2)  =  LL_IN_GA(x1)
U5_AG(x1, x2, x3, x4)  =  U5_AG(x4)

We have to consider all (P,R,Pi)-chains
The approximation of the Dependency Graph [30] contains 4 SCCs with 7 less nodes.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

LL_IN_AG(s(N), .(X, Xs)) → LL_IN_AG(N, Xs)

The TRS R consists of the following rules:

t_in_g(N) → U1_g(N, ll_in_ga(N, Xs))
ll_in_ga(s(N), .(X, Xs)) → U5_ga(N, X, Xs, ll_in_ga(N, Xs))
ll_in_ga(0, []) → ll_out_ga(0, [])
U5_ga(N, X, Xs, ll_out_ga(N, Xs)) → ll_out_ga(s(N), .(X, Xs))
U1_g(N, ll_out_ga(N, Xs)) → U2_g(N, select_in_aga(X, Xs, Xs1))
select_in_aga(X, .(Y, Xs), .(Y, Ys)) → U6_aga(X, Y, Xs, Ys, select_in_aga(X, Xs, Ys))
select_in_aga(X, .(X, Xs), Xs) → select_out_aga(X, .(X, Xs), Xs)
U6_aga(X, Y, Xs, Ys, select_out_aga(X, Xs, Ys)) → select_out_aga(X, .(Y, Xs), .(Y, Ys))
U2_g(N, select_out_aga(X, Xs, Xs1)) → U3_g(N, ll_in_ag(M, Xs1))
ll_in_ag(s(N), .(X, Xs)) → U5_ag(N, X, Xs, ll_in_ag(N, Xs))
ll_in_ag(0, []) → ll_out_ag(0, [])
U5_ag(N, X, Xs, ll_out_ag(N, Xs)) → ll_out_ag(s(N), .(X, Xs))
U3_g(N, ll_out_ag(M, Xs1)) → U4_g(N, t_in_g(M))
t_in_g(0) → t_out_g(0)
U4_g(N, t_out_g(M)) → t_out_g(N)

The argument filtering Pi contains the following mapping:
t_in_g(x1)  =  t_in_g(x1)
U1_g(x1, x2)  =  U1_g(x2)
ll_in_ga(x1, x2)  =  ll_in_ga(x1)
s(x1)  =  s(x1)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x4)
0  =  0
ll_out_ga(x1, x2)  =  ll_out_ga(x2)
.(x1, x2)  =  .(x2)
U2_g(x1, x2)  =  U2_g(x2)
select_in_aga(x1, x2, x3)  =  select_in_aga(x2)
U6_aga(x1, x2, x3, x4, x5)  =  U6_aga(x5)
select_out_aga(x1, x2, x3)  =  select_out_aga(x3)
U3_g(x1, x2)  =  U3_g(x2)
ll_in_ag(x1, x2)  =  ll_in_ag(x2)
U5_ag(x1, x2, x3, x4)  =  U5_ag(x4)
[]  =  []
ll_out_ag(x1, x2)  =  ll_out_ag(x1)
U4_g(x1, x2)  =  U4_g(x2)
t_out_g(x1)  =  t_out_g
LL_IN_AG(x1, x2)  =  LL_IN_AG(x2)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

LL_IN_AG(s(N), .(X, Xs)) → LL_IN_AG(N, Xs)

R is empty.
The argument filtering Pi contains the following mapping:
s(x1)  =  s(x1)
.(x1, x2)  =  .(x2)
LL_IN_AG(x1, x2)  =  LL_IN_AG(x2)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

LL_IN_AG(.(Xs)) → LL_IN_AG(Xs)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

SELECT_IN_AGA(X, .(Y, Xs), .(Y, Ys)) → SELECT_IN_AGA(X, Xs, Ys)

The TRS R consists of the following rules:

t_in_g(N) → U1_g(N, ll_in_ga(N, Xs))
ll_in_ga(s(N), .(X, Xs)) → U5_ga(N, X, Xs, ll_in_ga(N, Xs))
ll_in_ga(0, []) → ll_out_ga(0, [])
U5_ga(N, X, Xs, ll_out_ga(N, Xs)) → ll_out_ga(s(N), .(X, Xs))
U1_g(N, ll_out_ga(N, Xs)) → U2_g(N, select_in_aga(X, Xs, Xs1))
select_in_aga(X, .(Y, Xs), .(Y, Ys)) → U6_aga(X, Y, Xs, Ys, select_in_aga(X, Xs, Ys))
select_in_aga(X, .(X, Xs), Xs) → select_out_aga(X, .(X, Xs), Xs)
U6_aga(X, Y, Xs, Ys, select_out_aga(X, Xs, Ys)) → select_out_aga(X, .(Y, Xs), .(Y, Ys))
U2_g(N, select_out_aga(X, Xs, Xs1)) → U3_g(N, ll_in_ag(M, Xs1))
ll_in_ag(s(N), .(X, Xs)) → U5_ag(N, X, Xs, ll_in_ag(N, Xs))
ll_in_ag(0, []) → ll_out_ag(0, [])
U5_ag(N, X, Xs, ll_out_ag(N, Xs)) → ll_out_ag(s(N), .(X, Xs))
U3_g(N, ll_out_ag(M, Xs1)) → U4_g(N, t_in_g(M))
t_in_g(0) → t_out_g(0)
U4_g(N, t_out_g(M)) → t_out_g(N)

The argument filtering Pi contains the following mapping:
t_in_g(x1)  =  t_in_g(x1)
U1_g(x1, x2)  =  U1_g(x2)
ll_in_ga(x1, x2)  =  ll_in_ga(x1)
s(x1)  =  s(x1)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x4)
0  =  0
ll_out_ga(x1, x2)  =  ll_out_ga(x2)
.(x1, x2)  =  .(x2)
U2_g(x1, x2)  =  U2_g(x2)
select_in_aga(x1, x2, x3)  =  select_in_aga(x2)
U6_aga(x1, x2, x3, x4, x5)  =  U6_aga(x5)
select_out_aga(x1, x2, x3)  =  select_out_aga(x3)
U3_g(x1, x2)  =  U3_g(x2)
ll_in_ag(x1, x2)  =  ll_in_ag(x2)
U5_ag(x1, x2, x3, x4)  =  U5_ag(x4)
[]  =  []
ll_out_ag(x1, x2)  =  ll_out_ag(x1)
U4_g(x1, x2)  =  U4_g(x2)
t_out_g(x1)  =  t_out_g
SELECT_IN_AGA(x1, x2, x3)  =  SELECT_IN_AGA(x2)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

SELECT_IN_AGA(X, .(Y, Xs), .(Y, Ys)) → SELECT_IN_AGA(X, Xs, Ys)

R is empty.
The argument filtering Pi contains the following mapping:
.(x1, x2)  =  .(x2)
SELECT_IN_AGA(x1, x2, x3)  =  SELECT_IN_AGA(x2)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

SELECT_IN_AGA(.(Xs)) → SELECT_IN_AGA(Xs)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

LL_IN_GA(s(N), .(X, Xs)) → LL_IN_GA(N, Xs)

The TRS R consists of the following rules:

t_in_g(N) → U1_g(N, ll_in_ga(N, Xs))
ll_in_ga(s(N), .(X, Xs)) → U5_ga(N, X, Xs, ll_in_ga(N, Xs))
ll_in_ga(0, []) → ll_out_ga(0, [])
U5_ga(N, X, Xs, ll_out_ga(N, Xs)) → ll_out_ga(s(N), .(X, Xs))
U1_g(N, ll_out_ga(N, Xs)) → U2_g(N, select_in_aga(X, Xs, Xs1))
select_in_aga(X, .(Y, Xs), .(Y, Ys)) → U6_aga(X, Y, Xs, Ys, select_in_aga(X, Xs, Ys))
select_in_aga(X, .(X, Xs), Xs) → select_out_aga(X, .(X, Xs), Xs)
U6_aga(X, Y, Xs, Ys, select_out_aga(X, Xs, Ys)) → select_out_aga(X, .(Y, Xs), .(Y, Ys))
U2_g(N, select_out_aga(X, Xs, Xs1)) → U3_g(N, ll_in_ag(M, Xs1))
ll_in_ag(s(N), .(X, Xs)) → U5_ag(N, X, Xs, ll_in_ag(N, Xs))
ll_in_ag(0, []) → ll_out_ag(0, [])
U5_ag(N, X, Xs, ll_out_ag(N, Xs)) → ll_out_ag(s(N), .(X, Xs))
U3_g(N, ll_out_ag(M, Xs1)) → U4_g(N, t_in_g(M))
t_in_g(0) → t_out_g(0)
U4_g(N, t_out_g(M)) → t_out_g(N)

The argument filtering Pi contains the following mapping:
t_in_g(x1)  =  t_in_g(x1)
U1_g(x1, x2)  =  U1_g(x2)
ll_in_ga(x1, x2)  =  ll_in_ga(x1)
s(x1)  =  s(x1)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x4)
0  =  0
ll_out_ga(x1, x2)  =  ll_out_ga(x2)
.(x1, x2)  =  .(x2)
U2_g(x1, x2)  =  U2_g(x2)
select_in_aga(x1, x2, x3)  =  select_in_aga(x2)
U6_aga(x1, x2, x3, x4, x5)  =  U6_aga(x5)
select_out_aga(x1, x2, x3)  =  select_out_aga(x3)
U3_g(x1, x2)  =  U3_g(x2)
ll_in_ag(x1, x2)  =  ll_in_ag(x2)
U5_ag(x1, x2, x3, x4)  =  U5_ag(x4)
[]  =  []
ll_out_ag(x1, x2)  =  ll_out_ag(x1)
U4_g(x1, x2)  =  U4_g(x2)
t_out_g(x1)  =  t_out_g
LL_IN_GA(x1, x2)  =  LL_IN_GA(x1)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

LL_IN_GA(s(N), .(X, Xs)) → LL_IN_GA(N, Xs)

R is empty.
The argument filtering Pi contains the following mapping:
s(x1)  =  s(x1)
.(x1, x2)  =  .(x2)
LL_IN_GA(x1, x2)  =  LL_IN_GA(x1)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

LL_IN_GA(s(N)) → LL_IN_GA(N)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ UsableRulesProof

Pi DP problem:
The TRS P consists of the following rules:

U2_G(N, select_out_aga(X, Xs, Xs1)) → U3_G(N, ll_in_ag(M, Xs1))
T_IN_G(N) → U1_G(N, ll_in_ga(N, Xs))
U3_G(N, ll_out_ag(M, Xs1)) → T_IN_G(M)
U1_G(N, ll_out_ga(N, Xs)) → U2_G(N, select_in_aga(X, Xs, Xs1))

The TRS R consists of the following rules:

t_in_g(N) → U1_g(N, ll_in_ga(N, Xs))
ll_in_ga(s(N), .(X, Xs)) → U5_ga(N, X, Xs, ll_in_ga(N, Xs))
ll_in_ga(0, []) → ll_out_ga(0, [])
U5_ga(N, X, Xs, ll_out_ga(N, Xs)) → ll_out_ga(s(N), .(X, Xs))
U1_g(N, ll_out_ga(N, Xs)) → U2_g(N, select_in_aga(X, Xs, Xs1))
select_in_aga(X, .(Y, Xs), .(Y, Ys)) → U6_aga(X, Y, Xs, Ys, select_in_aga(X, Xs, Ys))
select_in_aga(X, .(X, Xs), Xs) → select_out_aga(X, .(X, Xs), Xs)
U6_aga(X, Y, Xs, Ys, select_out_aga(X, Xs, Ys)) → select_out_aga(X, .(Y, Xs), .(Y, Ys))
U2_g(N, select_out_aga(X, Xs, Xs1)) → U3_g(N, ll_in_ag(M, Xs1))
ll_in_ag(s(N), .(X, Xs)) → U5_ag(N, X, Xs, ll_in_ag(N, Xs))
ll_in_ag(0, []) → ll_out_ag(0, [])
U5_ag(N, X, Xs, ll_out_ag(N, Xs)) → ll_out_ag(s(N), .(X, Xs))
U3_g(N, ll_out_ag(M, Xs1)) → U4_g(N, t_in_g(M))
t_in_g(0) → t_out_g(0)
U4_g(N, t_out_g(M)) → t_out_g(N)

The argument filtering Pi contains the following mapping:
t_in_g(x1)  =  t_in_g(x1)
U1_g(x1, x2)  =  U1_g(x2)
ll_in_ga(x1, x2)  =  ll_in_ga(x1)
s(x1)  =  s(x1)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x4)
0  =  0
ll_out_ga(x1, x2)  =  ll_out_ga(x2)
.(x1, x2)  =  .(x2)
U2_g(x1, x2)  =  U2_g(x2)
select_in_aga(x1, x2, x3)  =  select_in_aga(x2)
U6_aga(x1, x2, x3, x4, x5)  =  U6_aga(x5)
select_out_aga(x1, x2, x3)  =  select_out_aga(x3)
U3_g(x1, x2)  =  U3_g(x2)
ll_in_ag(x1, x2)  =  ll_in_ag(x2)
U5_ag(x1, x2, x3, x4)  =  U5_ag(x4)
[]  =  []
ll_out_ag(x1, x2)  =  ll_out_ag(x1)
U4_g(x1, x2)  =  U4_g(x2)
t_out_g(x1)  =  t_out_g
U2_G(x1, x2)  =  U2_G(x2)
T_IN_G(x1)  =  T_IN_G(x1)
U1_G(x1, x2)  =  U1_G(x2)
U3_G(x1, x2)  =  U3_G(x2)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof

Pi DP problem:
The TRS P consists of the following rules:

U2_G(N, select_out_aga(X, Xs, Xs1)) → U3_G(N, ll_in_ag(M, Xs1))
T_IN_G(N) → U1_G(N, ll_in_ga(N, Xs))
U3_G(N, ll_out_ag(M, Xs1)) → T_IN_G(M)
U1_G(N, ll_out_ga(N, Xs)) → U2_G(N, select_in_aga(X, Xs, Xs1))

The TRS R consists of the following rules:

ll_in_ag(s(N), .(X, Xs)) → U5_ag(N, X, Xs, ll_in_ag(N, Xs))
ll_in_ag(0, []) → ll_out_ag(0, [])
ll_in_ga(s(N), .(X, Xs)) → U5_ga(N, X, Xs, ll_in_ga(N, Xs))
ll_in_ga(0, []) → ll_out_ga(0, [])
select_in_aga(X, .(Y, Xs), .(Y, Ys)) → U6_aga(X, Y, Xs, Ys, select_in_aga(X, Xs, Ys))
select_in_aga(X, .(X, Xs), Xs) → select_out_aga(X, .(X, Xs), Xs)
U5_ag(N, X, Xs, ll_out_ag(N, Xs)) → ll_out_ag(s(N), .(X, Xs))
U5_ga(N, X, Xs, ll_out_ga(N, Xs)) → ll_out_ga(s(N), .(X, Xs))
U6_aga(X, Y, Xs, Ys, select_out_aga(X, Xs, Ys)) → select_out_aga(X, .(Y, Xs), .(Y, Ys))

The argument filtering Pi contains the following mapping:
ll_in_ga(x1, x2)  =  ll_in_ga(x1)
s(x1)  =  s(x1)
U5_ga(x1, x2, x3, x4)  =  U5_ga(x4)
0  =  0
ll_out_ga(x1, x2)  =  ll_out_ga(x2)
.(x1, x2)  =  .(x2)
select_in_aga(x1, x2, x3)  =  select_in_aga(x2)
U6_aga(x1, x2, x3, x4, x5)  =  U6_aga(x5)
select_out_aga(x1, x2, x3)  =  select_out_aga(x3)
ll_in_ag(x1, x2)  =  ll_in_ag(x2)
U5_ag(x1, x2, x3, x4)  =  U5_ag(x4)
[]  =  []
ll_out_ag(x1, x2)  =  ll_out_ag(x1)
U2_G(x1, x2)  =  U2_G(x2)
T_IN_G(x1)  =  T_IN_G(x1)
U1_G(x1, x2)  =  U1_G(x2)
U3_G(x1, x2)  =  U3_G(x2)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ RuleRemovalProof

Q DP problem:
The TRS P consists of the following rules:

T_IN_G(N) → U1_G(ll_in_ga(N))
U3_G(ll_out_ag(M)) → T_IN_G(M)
U2_G(select_out_aga(Xs1)) → U3_G(ll_in_ag(Xs1))
U1_G(ll_out_ga(Xs)) → U2_G(select_in_aga(Xs))

The TRS R consists of the following rules:

ll_in_ag(.(Xs)) → U5_ag(ll_in_ag(Xs))
ll_in_ag([]) → ll_out_ag(0)
ll_in_ga(s(N)) → U5_ga(ll_in_ga(N))
ll_in_ga(0) → ll_out_ga([])
select_in_aga(.(Xs)) → U6_aga(select_in_aga(Xs))
select_in_aga(.(Xs)) → select_out_aga(Xs)
U5_ag(ll_out_ag(N)) → ll_out_ag(s(N))
U5_ga(ll_out_ga(Xs)) → ll_out_ga(.(Xs))
U6_aga(select_out_aga(Ys)) → select_out_aga(.(Ys))

The set Q consists of the following terms:

ll_in_ag(x0)
ll_in_ga(x0)
select_in_aga(x0)
U5_ag(x0)
U5_ga(x0)
U6_aga(x0)

We have to consider all (P,Q,R)-chains.
By using the rule removal processor [15] with the following polynomial ordering [25], at least one Dependency Pair or term rewrite system rule of this QDP problem can be strictly oriented.
Strictly oriented dependency pairs:

U2_G(select_out_aga(Xs1)) → U3_G(ll_in_ag(Xs1))
U1_G(ll_out_ga(Xs)) → U2_G(select_in_aga(Xs))

Strictly oriented rules of the TRS R:

U6_aga(select_out_aga(Ys)) → select_out_aga(.(Ys))

Used ordering: POLO with Polynomial interpretation [25]:

POL(.(x1)) = 2 + 2·x1   
POL(0) = 0   
POL(T_IN_G(x1)) = 1 + 2·x1   
POL(U1_G(x1)) = x1   
POL(U2_G(x1)) = x1   
POL(U3_G(x1)) = 1 + x1   
POL(U5_ag(x1)) = 2 + 2·x1   
POL(U5_ga(x1)) = 1 + 2·x1   
POL(U6_aga(x1)) = 2 + 2·x1   
POL([]) = 0   
POL(ll_in_ag(x1)) = x1   
POL(ll_in_ga(x1)) = 1 + 2·x1   
POL(ll_out_ag(x1)) = 2·x1   
POL(ll_out_ga(x1)) = 1 + x1   
POL(s(x1)) = 1 + 2·x1   
POL(select_in_aga(x1)) = x1   
POL(select_out_aga(x1)) = 2 + x1   



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ RuleRemovalProof
QDP
                            ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

T_IN_G(N) → U1_G(ll_in_ga(N))
U3_G(ll_out_ag(M)) → T_IN_G(M)

The TRS R consists of the following rules:

ll_in_ag(.(Xs)) → U5_ag(ll_in_ag(Xs))
ll_in_ag([]) → ll_out_ag(0)
ll_in_ga(s(N)) → U5_ga(ll_in_ga(N))
ll_in_ga(0) → ll_out_ga([])
select_in_aga(.(Xs)) → U6_aga(select_in_aga(Xs))
select_in_aga(.(Xs)) → select_out_aga(Xs)
U5_ag(ll_out_ag(N)) → ll_out_ag(s(N))
U5_ga(ll_out_ga(Xs)) → ll_out_ga(.(Xs))

The set Q consists of the following terms:

ll_in_ag(x0)
ll_in_ga(x0)
select_in_aga(x0)
U5_ag(x0)
U5_ga(x0)
U6_aga(x0)

We have to consider all (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 0 SCCs with 2 less nodes.